import request from '@/utils/request'

// 查询主题列表
export function listSubject(query) {
  return request({
    url: '/items/subject/list',
    method: 'get',
    params: query
  })
}

// 查询主题关联的事项
export function getListServiceSubject(query) {
    return request({
      url: '/items/subject/listServiceSubject',
      method: 'get',
      params: query
    })
}

// 查询主题详细
export function getSubject(id) {
   return request({
     url: '/items/subject/' + id,
     method: 'get'
   })
}

// 新增主题
export function addSubject(data) {
  return request({
    url: '/items/subject',
    method: 'post',
    data
  })
}

// 修改主题
export function updateSubject(data) {
  return request({
    url: '/items/subject',
    method: 'put',
    data: data
  })
}

// 删除主题
export function delSubject(id) {
  return request({
    url: '/items/subject/' + id,
    method: 'delete'
  })
}

// 查询主题未关联的事项
export function getListExcludeSubject(query) {
  return request({
    url: '/items/subject/listExcludeSubject',
    method: 'get',
    params: query
  })
}

// 新增主题事项
export function batchAddServiceSubject(data) {
  return request({
    url: '/items/subject/batchAddServiceSubject',
    method: 'post',
    data
  })
}

// 复制父网点主题
export function copyParentBranchSubjects(data) {
  return request({
    url: '/cfgBranch/copy',
    method: 'post',
    data
  })
}

// 删除主题内事项
export function removeServiceSubject(data) {
  return request({
    url: '/items/subject/removeServiceSubject/',
    method: 'delete',
    data
  })
}

// 查询网点包含主题
export function selectTCfgSubjectByBranchCode(query) {
  return request({
    url: '/items/subject/selectTCfgSubjectByBranchCode',
    method: 'get',
    params: query
  })
}

// 修改主题内事项序号
export function editServiceSubject(data) {
  return request({
    url: '/items/subject/editServiceSubject',
    method: 'post',
    data
  })
}

// 修改主题序号
export function updateTCfgSubjectSortWhenSubjectCode(data) {
  return request({
    url: '/items/subject/updateTCfgSubjectSortWhenSubjectCode',
    method: 'post',
    data: data
  })
}

// 获取所有主题列表
export function listForSubject(query) {
  return request({
    url: '/items/subject/listForSubject',
    method: 'get',
    params: query
  })
}

// 查询关联表单列表
export function getListFormSubject(query){
  return request({
    url: '/items/subject/listFormSubject',
    method: 'get',
    params: query
  })
}

// 查询出未关联表单列表
export function getListExcludeForm(query) {
  return request({
    url: '/items/subject/listExcludeForm',
    method: 'post',
    data: query
  })
}

// 批量添加表单主题
export function batchAddFormSubject(data){
  return request({
    url: '/items/subject/batchAddFormSubject',
    method: 'post',
    data
  })
}

// 删除主题表单
export function removeFormSubject(id){
  return request({
    url:'/items/subject/removeFormSubject/' + id,
    method:'delete',
  })
}

// 修改表单主题
export function editFormSubject(data){
  return request({
    url:'/items/subject/updateFormSubject',
    method:'put',
    data
  })
}

// 取消关联主题表单
// export function relForm (data){
//   return request({
//     url:'/items/subject/relForm',
//     method:'post',
//     data
//   })
// }
